<?php

declare(strict_types=1);

namespace app\controller;

use app\BaseController;
use app\model\Posts as PostsModel;

class Posts extends BaseController
{
    public function index($page = 1, $per_page = 10)
    {
        $list = PostsModel::paginate([
            'list_rows' => $per_page,
            'page' => $page
        ]);

        return $this->result('获取成功', $list);
    }

    public function create()
    {
        if (!$this->token) return $this->result('请先登录', [], 40000);
        $params = $this->request->post();
        
    }
}
